<?php

/**
 * Class contains method for each classes of project and generates error message for the same.
 *
 */

namespace Utils;

class ErrorManager
{

    public static $errorMatrix;

    /**
     * Returns error object
     */
    public static function getError($className, $functionName, $segmentId)
    {
        self::setErrorMatrix($className);

        $code = '';
        $message = '';
        if (!empty(self::$errorMatrix[$className]['classId']) && !empty(self::$errorMatrix[$className]['functionMatrix'][$functionName]['functionId']))
        {
            $code = self::$errorMatrix[$className]['classId'] . self::$errorMatrix[$className]['functionMatrix'][$functionName]['functionId'] . $segmentId;
            $message = self::$errorMatrix[$className]['functionMatrix'][$functionName]['segmentMatrix'][$segmentId];
        }

        $errorObject = array();
        $errorObject['message'] = $message;
        $errorObject['code'] = $code;

        return $errorObject;
    }

    public static function makeError($code, $message)
    {
        $errorObject = array();
        $errorObject['message'] = $message;
        $errorObject['code'] = $code;

        return $errorObject;
    }

    public static function setErrorMatrix($className)
    {
        if (method_exists('ErrorManager', $className) == true)
        {
            self::$errorMatrix[$className] = self::$className();
        }
    }

    public static function LoginController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '01';

        $errorMatrix['functionMatrix']['login']['functionId'] = '00';
        $errorMatrix['functionMatrix']['login']['segmentMatrix']['00'] = 'Organization not found!';
        $errorMatrix['functionMatrix']['login']['segmentMatrix']['01'] = 'Invalid Username or Password!';
        $errorMatrix['functionMatrix']['login']['segmentMatrix']['02'] = 'Your licence is expired, please renew to continue!';
        
        $errorMatrix['functionMatrix']['login']['functionId'] = '01';
        $errorMatrix['functionMatrix']['login']['segmentMatrix']['00'] = 'Organization not found!';
        $errorMatrix['functionMatrix']['login']['segmentMatrix']['01'] = 'Invalid Username or Password!';
        $errorMatrix['functionMatrix']['login']['segmentMatrix']['02'] = 'Your licence is expired, please renew to continue!';

        return $errorMatrix;
    }

    public static function UserController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '02';

        $errorMatrix['functionMatrix']['getAllUsers']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getAllUsers']['segmentMatrix']['00'] = 'No users found!';

        $errorMatrix['functionMatrix']['getUserInfo']['functionId'] = '01';
        $errorMatrix['functionMatrix']['getUserInfo']['segmentMatrix']['00'] = 'No such user found!';
        $errorMatrix['functionMatrix']['getUserInfo']['segmentMatrix']['01'] = 'Error while retrieving group in user!';
        $errorMatrix['functionMatrix']['getUserInfo']['segmentMatrix']['02'] = 'Error while retrieving kpi in user!';

        $errorMatrix['functionMatrix']['addUser']['functionId'] = '02';
        $errorMatrix['functionMatrix']['addUser']['segmentMatrix']['00'] = 'Error While validating user!';

        $errorMatrix['functionMatrix']['getAliases']['functionId'] = '03';
        $errorMatrix['functionMatrix']['getAliases']['segmentMatrix']['00'] = 'No user found with alias!';

        $errorMatrix['functionMatrix']['removeUser']['functionId'] = '04';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['00'] = 'No such user found!';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['01'] = 'Error while deleting user!';

        $errorMatrix['functionMatrix']['restoreUser']['functionId'] = '05';
        $errorMatrix['functionMatrix']['restoreUser']['segmentMatrix']['00'] = 'No such user found!';
        $errorMatrix['functionMatrix']['restoreUser']['segmentMatrix']['01'] = 'Error while restoring user!';

        $errorMatrix['functionMatrix']['updateUser']['functionId'] = '06';
        $errorMatrix['functionMatrix']['updateUser']['segmentMatrix']['00'] = 'Nothing to Update!';
        $errorMatrix['functionMatrix']['updateUser']['segmentMatrix']['01'] = 'Error while updating user!';

        $errorMatrix['functionMatrix']['removeKpi']['functionId'] = '07';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['00'] = 'No group ID provided!';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['01'] = 'No kpi ID provided!';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['02'] = 'Error while removing kpi from user!';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['03'] = 'Error while removing user from kpi!';

        $errorMatrix['functionMatrix']['addKpi']['functionId'] = '08';
        $errorMatrix['functionMatrix']['addKpi']['segmentMatrix']['00'] = 'No group ID provided!';
        $errorMatrix['functionMatrix']['addKpi']['segmentMatrix']['01'] = 'No kpi ID provided!';
        $errorMatrix['functionMatrix']['addKpi']['segmentMatrix']['02'] = 'Error while adding kpi to user!';
        $errorMatrix['functionMatrix']['addKpi']['segmentMatrix']['03'] = 'Error while adding user to kpi!';

        $errorMatrix['functionMatrix']['isNumberExists']['functionId'] = '09';
        $errorMatrix['functionMatrix']['isNumberExists']['segmentMatrix']['00'] = 'No such number exists in collection!';

        $errorMatrix['functionMatrix']['getKpiSequence']['functionId'] = '10';
        $errorMatrix['functionMatrix']['getKpiSequence']['segmentMatrix']['00'] = 'No userId in session, login again!';
        $errorMatrix['functionMatrix']['getKpiSequence']['segmentMatrix']['01'] = 'No kpiSequqnce present!';

        $errorMatrix['functionMatrix']['updateKpiSequence']['functionId'] = '11';
        $errorMatrix['functionMatrix']['updateKpiSequence']['segmentMatrix']['00'] = 'No userId in session, login again!';
        $errorMatrix['functionMatrix']['updateKpiSequence']['segmentMatrix']['01'] = 'Error while updating kpi sequence!';

        $errorMatrix['functionMatrix']['importUsers']['functionId'] = '12';
        $errorMatrix['functionMatrix']['importUsers']['segmentMatrix']['00'] = '\'file\' is a required field!';
        $errorMatrix['functionMatrix']['importUsers']['segmentMatrix']['01'] = 'Selected file is NOT a \'CSV\' file!';
        $errorMatrix['functionMatrix']['importUsers']['segmentMatrix']['02'] = 'No user imported successfully!';


        return $errorMatrix;
    }

    public static function KpiController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '03';

        $errorMatrix['functionMatrix']['getAllKpis']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getAllKpis']['segmentMatrix']['00'] = 'No kpis found!';

        $errorMatrix['functionMatrix']['getKpiInfo']['functionId'] = '01';
        $errorMatrix['functionMatrix']['getKpiInfo']['segmentMatrix']['00'] = 'No such kpi found!';
        $errorMatrix['functionMatrix']['getKpiInfo']['segmentMatrix']['01'] = 'Error while retrieving group in kpi!';
        $errorMatrix['functionMatrix']['getKpiInfo']['segmentMatrix']['02'] = 'Error while retrieving user in kpi!';

        $errorMatrix['functionMatrix']['addKpi']['functionId'] = '02';
        $errorMatrix['functionMatrix']['addKpi']['segmentMatrix']['00'] = 'Error While validating kpi!';
        $errorMatrix['functionMatrix']['addKpi']['segmentMatrix']['00'] = 'Error While adding kpi to kpis used in formula!';

        $errorMatrix['functionMatrix']['getAliases']['functionId'] = '03';
        $errorMatrix['functionMatrix']['getAliases']['segmentMatrix']['00'] = 'No kpi found for alias!';

        $errorMatrix['functionMatrix']['removeKpi']['functionId'] = '04';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['00'] = 'No such kpi found!';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['01'] = 'Error while deleting kpi!';

        $errorMatrix['functionMatrix']['restoreKpi']['functionId'] = '05';
        $errorMatrix['functionMatrix']['restoreKpi']['segmentMatrix']['00'] = 'No such kpi found!';
        $errorMatrix['functionMatrix']['restoreKpi']['segmentMatrix']['01'] = 'Error while restoring kpi!';

        $errorMatrix['functionMatrix']['updateKpi']['functionId'] = '06';
        $errorMatrix['functionMatrix']['updateKpi']['segmentMatrix']['00'] = 'Nothing to Update!';
        $errorMatrix['functionMatrix']['updateKpi']['segmentMatrix']['01'] = 'Error while updating kpi!';

        $errorMatrix['functionMatrix']['removeUser']['functionId'] = '07';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['00'] = 'No group ID provided!';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['01'] = 'No user ID provided!';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['02'] = 'Error while removing user from kpi!';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['03'] = 'Error while removing kpi from user!';

        $errorMatrix['functionMatrix']['addUser']['functionId'] = '08';
        $errorMatrix['functionMatrix']['addUser']['segmentMatrix']['00'] = 'No group ID provided!';
        $errorMatrix['functionMatrix']['addUser']['segmentMatrix']['01'] = 'No kpi ID provided!';
        $errorMatrix['functionMatrix']['addUser']['segmentMatrix']['02'] = 'Error while adding user to kpi!';
        $errorMatrix['functionMatrix']['addUser']['segmentMatrix']['03'] = 'Error while adding kpi to user!';

        $errorMatrix['functionMatrix']['checkFormula']['functionId'] = '09';
        $errorMatrix['functionMatrix']['checkFormula']['segmentMatrix']['00'] = 'No formula provided!';
        $errorMatrix['functionMatrix']['checkFormula']['segmentMatrix']['01'] = 'Not a valid formula! try again!';
        $errorMatrix['functionMatrix']['checkFormula']['segmentMatrix']['02'] = 'One or more kpi used in formula doesn\'t exists ! try again!';

        $errorMatrix['functionMatrix']['verifyFormula']['functionId'] = '10';
        $errorMatrix['functionMatrix']['verifyFormula']['segmentMatrix']['00'] = 'Insufficient parameters provided!';

        $errorMatrix['functionMatrix']['addTemplateKpi']['functionId'] = '10';
        $errorMatrix['functionMatrix']['addTemplateKpi']['segmentMatrix']['00'] = 'No Input provided!!';
        $errorMatrix['functionMatrix']['addTemplateKpi']['segmentMatrix']['01'] = 'Kpis used in formula doesn\'t exists!!';


        return $errorMatrix;
    }

    public static function GroupController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '04';

        $errorMatrix['functionMatrix']['getAllGroups']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getAllGroups']['segmentMatrix']['00'] = 'No groups found!';

        $errorMatrix['functionMatrix']['getGroupInfo']['functionId'] = '01';
        $errorMatrix['functionMatrix']['getGroupInfo']['segmentMatrix']['00'] = 'No groups found!';
        $errorMatrix['functionMatrix']['getGroupInfo']['segmentMatrix']['01'] = 'No such kpi found in collection!';
        $errorMatrix['functionMatrix']['getGroupInfo']['segmentMatrix']['02'] = 'No such user found in collection!';
        $errorMatrix['functionMatrix']['getGroupInfo']['segmentMatrix']['03'] = 'No such aggregate kpi found in Group!';

        $errorMatrix['functionMatrix']['addGroup']['functionId'] = '02';
        $errorMatrix['functionMatrix']['addGroup']['segmentMatrix']['00'] = 'Error while validating group!';
        $errorMatrix['functionMatrix']['addGroup']['segmentMatrix']['01'] = 'Error while saving group!';

        $errorMatrix['functionMatrix']['getAliases']['functionId'] = '03';
        $errorMatrix['functionMatrix']['getAliases']['segmentMatrix']['00'] = 'No group found for alias!';

        $errorMatrix['functionMatrix']['removeGroup']['functionId'] = '04';
        $errorMatrix['functionMatrix']['removeGroup']['segmentMatrix']['00'] = 'No such group found!';
        $errorMatrix['functionMatrix']['removeGroup']['segmentMatrix']['01'] = 'Error while removing group!';

        $errorMatrix['functionMatrix']['restoreGroup']['functionId'] = '05';
        $errorMatrix['functionMatrix']['restoreGroup']['segmentMatrix']['00'] = 'No such group found!';
        $errorMatrix['functionMatrix']['restoreGroup']['segmentMatrix']['01'] = 'Error while restoring group!';

        $errorMatrix['functionMatrix']['updateGroup']['functionId'] = '06';
        $errorMatrix['functionMatrix']['updateGroup']['segmentMatrix']['00'] = 'Nothing to Update!';
        $errorMatrix['functionMatrix']['updateGroup']['segmentMatrix']['01'] = 'Error while updating group!';

        $errorMatrix['functionMatrix']['addUsers']['functionId'] = '07';
        $errorMatrix['functionMatrix']['addUsers']['segmentMatrix']['00'] = 'No users provided to add!';
        $errorMatrix['functionMatrix']['addUsers']['segmentMatrix']['01'] = 'No such group found!';
        $errorMatrix['functionMatrix']['addUsers']['segmentMatrix']['02'] = 'Error while adding users to group!';
        $errorMatrix['functionMatrix']['addUsers']['segmentMatrix']['03'] = 'Error while adding kpis to new users!';
        $errorMatrix['functionMatrix']['addUsers']['segmentMatrix']['04'] = 'Error while adding users to kpis!';

        $errorMatrix['functionMatrix']['removeUser']['functionId'] = '08';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['00'] = 'No user provided to remove!';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['01'] = 'Error while removing user from group!';
        $errorMatrix['functionMatrix']['removeUser']['segmentMatrix']['02'] = 'Error while removing group from user!';

        $errorMatrix['functionMatrix']['addKpis']['functionId'] = '09';
        $errorMatrix['functionMatrix']['addKpis']['segmentMatrix']['00'] = 'No kpi provided to remove!';
        $errorMatrix['functionMatrix']['addKpis']['segmentMatrix']['01'] = 'No such group found!';
        $errorMatrix['functionMatrix']['addKpis']['segmentMatrix']['02'] = 'Error while adding kpis to group!';
        $errorMatrix['functionMatrix']['addKpis']['segmentMatrix']['03'] = 'Error while adding group to kpi!';
        $errorMatrix['functionMatrix']['addKpis']['segmentMatrix']['04'] = 'Error while adding group to user!';
        $errorMatrix['functionMatrix']['addKpis']['segmentMatrix']['05'] = 'Some or all Kpis used in formula doesn\'t exists in group!';

        $errorMatrix['functionMatrix']['removeKpi']['functionId'] = '10';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['00'] = 'No kpi provided to remove!';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['01'] = 'Error while removing kpi from group!';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['02'] = 'Error while removing group from kpi!';
        $errorMatrix['functionMatrix']['removeKpi']['segmentMatrix']['03'] = 'Error while removing kpi from user!';

        $errorMatrix['functionMatrix']['toggleLeader']['functionId'] = '11';
        $errorMatrix['functionMatrix']['toggleLeader']['segmentMatrix']['00'] = 'No current status provided!';
        $errorMatrix['functionMatrix']['toggleLeader']['segmentMatrix']['01'] = 'No user provided!';
        $errorMatrix['functionMatrix']['toggleLeader']['segmentMatrix']['02'] = 'Error while toggling leader status!';

        $errorMatrix['functionMatrix']['toggleAggregate']['functionId'] = '12';
        $errorMatrix['functionMatrix']['toggleAggregate']['segmentMatrix']['00'] = 'No current status provided!';
        $errorMatrix['functionMatrix']['toggleAggregate']['segmentMatrix']['01'] = 'No kpi provided!';
        $errorMatrix['functionMatrix']['toggleAggregate']['segmentMatrix']['02'] = 'Error while toggling aggregate status!';

        $errorMatrix['functionMatrix']['getParentList']['functionId'] = '13';
        $errorMatrix['functionMatrix']['getParentList']['segmentMatrix']['00'] = 'No group Id provided!';
        $errorMatrix['functionMatrix']['getParentList']['segmentMatrix']['01'] = 'No groups found!';

        $errorMatrix['functionMatrix']['importGroups']['functionId'] = '14';
        $errorMatrix['functionMatrix']['importGroups']['segmentMatrix']['00'] = '\'file\' is a required field!';
        $errorMatrix['functionMatrix']['importGroups']['segmentMatrix']['01'] = 'Selected file is NOT a \'CSV\' file!';
        $errorMatrix['functionMatrix']['importGroups']['segmentMatrix']['02'] = 'No group imported successfully!';
        
        $errorMatrix['functionMatrix']['importKpiTemplateToGroup']['functionId'] = '15';
        $errorMatrix['functionMatrix']['importKpiTemplateToGroup']['segmentMatrix']['00'] = 'No Template provided to add!!';
        $errorMatrix['functionMatrix']['importKpiTemplateToGroup']['segmentMatrix']['01'] = 'No kpi successfully added to collection!!';

        return $errorMatrix;
    }

    public static function UnitController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '05';

        $errorMatrix['functionMatrix']['getAllUnits']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getAllUnits']['segmentMatrix']['00'] = 'No unit found in collection!';

        $errorMatrix['functionMatrix']['addUnit']['functionId'] = '01';
        $errorMatrix['functionMatrix']['addUnit']['segmentMatrix']['00'] = 'Error while validating unit!';
        $errorMatrix['functionMatrix']['addUnit']['segmentMatrix']['01'] = 'Error while saving unit!';

        $errorMatrix['functionMatrix']['getUnitInfo']['functionId'] = '02';
        $errorMatrix['functionMatrix']['getUnitInfo']['segmentMatrix']['00'] = 'No such unit found!';

        $errorMatrix['functionMatrix']['updateUnit']['functionId'] = '03';
        $errorMatrix['functionMatrix']['updateUnit']['segmentMatrix']['00'] = 'Nothing to update!!';
        $errorMatrix['functionMatrix']['updateUnit']['segmentMatrix']['01'] = 'Error while updating unit!';

        $errorMatrix['functionMatrix']['removeUnit']['functionId'] = '04';
        $errorMatrix['functionMatrix']['removeUnit']['segmentMatrix']['00'] = 'No such unit found!';
        $errorMatrix['functionMatrix']['removeUnit']['segmentMatrix']['01'] = 'Error while removing unit!';

        $errorMatrix['functionMatrix']['restoreUnit']['functionId'] = '05';
        $errorMatrix['functionMatrix']['restoreUnit']['segmentMatrix']['00'] = 'No such unit found!';
        $errorMatrix['functionMatrix']['restoreUnit']['segmentMatrix']['01'] = 'Error while restoring unit!';

        return $errorMatrix;
    }

    public static function SettingController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '06';

        $errorMatrix['functionMatrix']['getAllSettings']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getAllSettings']['segmentMatrix']['00'] = 'No setting found in collection!';

        $errorMatrix['functionMatrix']['addSetting']['functionId'] = '01';
        $errorMatrix['functionMatrix']['addSetting']['segmentMatrix']['00'] = 'Error while validating setting!';
        $errorMatrix['functionMatrix']['addSetting']['segmentMatrix']['01'] = 'Error while saving setting!';

        $errorMatrix['functionMatrix']['getSettingInfo']['functionId'] = '02';
        $errorMatrix['functionMatrix']['getSettingInfo']['segmentMatrix']['00'] = 'No such setting found!';

        $errorMatrix['functionMatrix']['updateSetting']['functionId'] = '03';
        $errorMatrix['functionMatrix']['updateSetting']['segmentMatrix']['00'] = 'Nothing to update!!';
        $errorMatrix['functionMatrix']['updateSetting']['segmentMatrix']['01'] = 'Error while updating setting!';

        $errorMatrix['functionMatrix']['removeSetting']['functionId'] = '04';
        $errorMatrix['functionMatrix']['removeSetting']['segmentMatrix']['00'] = 'No such setting found!';
        $errorMatrix['functionMatrix']['removeSetting']['segmentMatrix']['01'] = 'Error while removing setting!';

        $errorMatrix['functionMatrix']['restoreSetting']['functionId'] = '05';
        $errorMatrix['functionMatrix']['restoreSetting']['segmentMatrix']['00'] = 'No such setting found!';
        $errorMatrix['functionMatrix']['restoreSetting']['segmentMatrix']['01'] = 'Error while restoring setting!';

        $errorMatrix['functionMatrix']['getSettingByKey']['functionId'] = '06';
        $errorMatrix['functionMatrix']['getSettingByKey']['segmentMatrix']['00'] = 'No Key provided!';
        $errorMatrix['functionMatrix']['getSettingByKey']['segmentMatrix']['01'] = 'No such setting found!';

        return $errorMatrix;
    }

    public static function DueEntryController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '07';

        $errorMatrix['functionMatrix']['sendDueEntry']['functionId'] = '00';
        $errorMatrix['functionMatrix']['sendDueEntry']['segmentMatrix']['00'] = 'No setting found in collection!';

        $errorMatrix['functionMatrix']['store']['functionId'] = '01';
        $errorMatrix['functionMatrix']['store']['segmentMatrix']['00'] = 'Error while validating due entry!';
        $errorMatrix['functionMatrix']['store']['segmentMatrix']['01'] = 'Error while saving due entry!';

        $errorMatrix['functionMatrix']['show']['functionId'] = '02';
        $errorMatrix['functionMatrix']['show']['segmentMatrix']['00'] = 'No such setting found!';

        $errorMatrix['functionMatrix']['update']['functionId'] = '03';
        $errorMatrix['functionMatrix']['update']['segmentMatrix']['00'] = 'Nothing to update!!';
        $errorMatrix['functionMatrix']['update']['segmentMatrix']['01'] = 'Error while updating due entry!';

        $errorMatrix['functionMatrix']['destroy']['functionId'] = '04';
        $errorMatrix['functionMatrix']['destroy']['segmentMatrix']['00'] = 'No such setting found!';
        $errorMatrix['functionMatrix']['destroy']['segmentMatrix']['01'] = 'Error while removing due entry!';

//        $errorMatrix['functionMatrix']['restoreSetting']['functionId'] = '05';
//        $errorMatrix['functionMatrix']['restoreSetting']['segmentMatrix']['00'] = 'No such setting found!';
//        $errorMatrix['functionMatrix']['restoreSetting']['segmentMatrix']['01'] = 'Error while restoring setting!';

        return $errorMatrix;
    }

    public static function HolidayController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '08';

        $errorMatrix['functionMatrix']['getAllHolidaysFromCollection']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getAllHolidaysFromCollection']['segmentMatrix']['00'] = 'No holidays found in collection!';

        $errorMatrix['functionMatrix']['addHoliday']['functionId'] = '01';
        $errorMatrix['functionMatrix']['addHoliday']['segmentMatrix']['00'] = 'Error while validating holiday!';
        $errorMatrix['functionMatrix']['addHoliday']['segmentMatrix']['01'] = 'Error while saving holiday!';

        $errorMatrix['functionMatrix']['getHolidayInfo']['functionId'] = '02';
        $errorMatrix['functionMatrix']['getHolidayInfo']['segmentMatrix']['00'] = 'No such holiday found!';

        $errorMatrix['functionMatrix']['getFullYearHolidays']['functionId'] = '03';
        $errorMatrix['functionMatrix']['getFullYearHolidays']['segmentMatrix']['00'] = 'No year provided!';

        $errorMatrix['functionMatrix']['removeHoliday']['functionId'] = '04';
        $errorMatrix['functionMatrix']['removeHoliday']['segmentMatrix']['00'] = 'No such holiday found!';
        $errorMatrix['functionMatrix']['removeHoliday']['segmentMatrix']['01'] = 'Error while removing holiday!';

        $errorMatrix['functionMatrix']['restoreHoliday']['functionId'] = '05';
        $errorMatrix['functionMatrix']['restoreHoliday']['segmentMatrix']['00'] = 'No such holiday found!';
        $errorMatrix['functionMatrix']['restoreHoliday']['segmentMatrix']['01'] = 'Error while restoring holiday!';

        $errorMatrix['functionMatrix']['getHolidayFromMonth']['functionId'] = '05';
        $errorMatrix['functionMatrix']['getHolidayFromMonth']['segmentMatrix']['00'] = 'No start or end date provided!';
        $errorMatrix['functionMatrix']['getHolidayFromMonth']['segmentMatrix']['01'] = 'Error while restoring holiday!';

        return $errorMatrix;
    }

    public static function GroupEntryEventHandler()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '09';

        $errorMatrix['functionMatrix']['onUserEntry']['functionId'] = '00';
        $errorMatrix['functionMatrix']['onUserEntry']['segmentMatrix']['00'] = 'No user entry in parameters!';
        $errorMatrix['functionMatrix']['onUserEntry']['segmentMatrix']['01'] = 'Error while updating group entry!';

        $errorMatrix['functionMatrix']['onUpdateUserEntry']['functionId'] = '01';
        $errorMatrix['functionMatrix']['onUpdateUserEntry']['segmentMatrix']['00'] = 'No previous group entry exists to update!';
        $errorMatrix['functionMatrix']['onUpdateUserEntry']['segmentMatrix']['01'] = 'No such group entry exists!';
        $errorMatrix['functionMatrix']['onUpdateUserEntry']['segmentMatrix']['02'] = 'Error while updating group entry!';

        $errorMatrix['functionMatrix']['addNewUserInGroup']['functionId'] = '02';
        $errorMatrix['functionMatrix']['addNewUserInGroup']['segmentMatrix']['00'] = 'no userId or entry provided!';

        $errorMatrix['functionMatrix']['onGroupEntry']['functionId'] = '03';
        $errorMatrix['functionMatrix']['onGroupEntry']['segmentMatrix']['00'] = 'No Entry Provided to add!';
        $errorMatrix['functionMatrix']['onGroupEntry']['segmentMatrix']['01'] = 'Error While saving entry to group!';

        $errorMatrix['functionMatrix']['onUpdateGroupEntry']['functionId'] = '04';
        $errorMatrix['functionMatrix']['onUpdateGroupEntry']['segmentMatrix']['00'] = 'No previous entryId provided to update!';
        $errorMatrix['functionMatrix']['onUpdateGroupEntry']['segmentMatrix']['01'] = 'Error while updating group entry!';

        $errorMatrix['functionMatrix']['restoreHoliday']['functionId'] = '05';
        $errorMatrix['functionMatrix']['restoreHoliday']['segmentMatrix']['00'] = 'No such holiday found!';
        $errorMatrix['functionMatrix']['restoreHoliday']['segmentMatrix']['01'] = 'Error while restoring holiday!';

        $errorMatrix['functionMatrix']['getHolidayFromMonth']['functionId'] = '05';
        $errorMatrix['functionMatrix']['getHolidayFromMonth']['segmentMatrix']['00'] = 'No start or end date provided!';
        $errorMatrix['functionMatrix']['getHolidayFromMonth']['segmentMatrix']['01'] = 'Error while restoring holiday!';

        return $errorMatrix;
    }

    public static function DashboardController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '10';

        $errorMatrix['functionMatrix']['getDashboards']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getDashboards']['segmentMatrix']['00'] = 'No Dashboard found in collection!';

        $errorMatrix['functionMatrix']['addDashboard']['functionId'] = '01';
        $errorMatrix['functionMatrix']['addDashboard']['segmentMatrix']['00'] = 'No data recieved!';
        $errorMatrix['functionMatrix']['addDashboard']['segmentMatrix']['01'] = 'Error while validating input(s)!';
        $errorMatrix['functionMatrix']['addDashboard']['segmentMatrix']['02'] = 'Error while saving Dashboard!';

        $errorMatrix['functionMatrix']['getDashboardInfo']['functionId'] = '02';
        $errorMatrix['functionMatrix']['getDashboardInfo']['segmentMatrix']['00'] = 'No dashboardId provided!';
        $errorMatrix['functionMatrix']['getDashboardInfo']['segmentMatrix']['01'] = 'No such dashboard found!';
        $errorMatrix['functionMatrix']['getDashboardInfo']['segmentMatrix']['02'] = 'No such user found with dashboard!';

        $errorMatrix['functionMatrix']['updateDashboard']['functionId'] = '03';
        $errorMatrix['functionMatrix']['updateDashboard']['segmentMatrix']['00'] = 'No dashboardId provided!';
        $errorMatrix['functionMatrix']['updateDashboard']['segmentMatrix']['01'] = 'Provided nothing to update!';
        $errorMatrix['functionMatrix']['updateDashboard']['segmentMatrix']['02'] = 'Error while updating dashboard in collection!';

        $errorMatrix['functionMatrix']['removeDashboard']['functionId'] = '04';
        $errorMatrix['functionMatrix']['removeDashboard']['segmentMatrix']['00'] = 'No dashboardId provided!';
        $errorMatrix['functionMatrix']['removeDashboard']['segmentMatrix']['01'] = 'No such dashboard found!';
        $errorMatrix['functionMatrix']['removeDashboard']['segmentMatrix']['02'] = 'Error while removing dashboard!';

        $errorMatrix['functionMatrix']['restoreDashboard']['functionId'] = '05';
        $errorMatrix['functionMatrix']['restoreDashboard']['segmentMatrix']['00'] = 'No dashboardId provided!';
        $errorMatrix['functionMatrix']['restoreDashboard']['segmentMatrix']['01'] = 'No such dashboard found!';
        $errorMatrix['functionMatrix']['restoreDashboard']['segmentMatrix']['02'] = 'Error while restoring dashboard!';


        return $errorMatrix;
    }

    public static function WidgetController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '11';

        $errorMatrix['functionMatrix']['getWidgets']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getWidgets']['segmentMatrix']['00'] = 'No widget found in collection!';

        $errorMatrix['functionMatrix']['addWidget']['functionId'] = '01';
        $errorMatrix['functionMatrix']['addWidget']['segmentMatrix']['00'] = 'No data recieved!';
        $errorMatrix['functionMatrix']['addWidget']['segmentMatrix']['01'] = 'Error while validating input(s)!';
        $errorMatrix['functionMatrix']['addWidget']['segmentMatrix']['02'] = 'Error while saving Widget!';

        $errorMatrix['functionMatrix']['getWidgetInfo']['functionId'] = '02';
        $errorMatrix['functionMatrix']['getWidgetInfo']['segmentMatrix']['00'] = 'No WidgetId provided!';
        $errorMatrix['functionMatrix']['getWidgetInfo']['segmentMatrix']['01'] = 'No such Widget found!';

        $errorMatrix['functionMatrix']['getWidgetByDashboardId']['functionId'] = '03';
        $errorMatrix['functionMatrix']['getWidgetByDashboardId']['segmentMatrix']['00'] = 'No DashboardId provided!';
        $errorMatrix['functionMatrix']['getWidgetByDashboardId']['segmentMatrix']['01'] = 'No Widgets found in dashboard!';

        $errorMatrix['functionMatrix']['updateWidget']['functionId'] = '04';
        $errorMatrix['functionMatrix']['updateWidget']['segmentMatrix']['00'] = 'No widgetId provided!';
        $errorMatrix['functionMatrix']['updateWidget']['segmentMatrix']['01'] = 'Provided nothing to update!';
        $errorMatrix['functionMatrix']['updateWidget']['segmentMatrix']['02'] = 'No such Widget found!';
        $errorMatrix['functionMatrix']['updateWidget']['segmentMatrix']['03'] = 'Error while updating widget in collection!';

        $errorMatrix['functionMatrix']['removeWidget']['functionId'] = '05';
        $errorMatrix['functionMatrix']['removeWidget']['segmentMatrix']['00'] = 'No WidgetId provided!';
        $errorMatrix['functionMatrix']['removeWidget']['segmentMatrix']['01'] = 'No such widget found!';
        $errorMatrix['functionMatrix']['removeWidget']['segmentMatrix']['02'] = 'Error while removing widget!';

        $errorMatrix['functionMatrix']['restoreWidget']['functionId'] = '06';
        $errorMatrix['functionMatrix']['restoreWidget']['segmentMatrix']['00'] = 'No WidgetId provided!';
        $errorMatrix['functionMatrix']['restoreWidget']['segmentMatrix']['01'] = 'No such Widget found!';
        $errorMatrix['functionMatrix']['restoreWidget']['segmentMatrix']['02'] = 'Error while restoring widget!';

        $errorMatrix['functionMatrix']['getUserInfo']['functionId'] = '07';
        $errorMatrix['functionMatrix']['getUserInfo']['segmentMatrix']['00'] = 'No such user found!';
        $errorMatrix['functionMatrix']['getUserInfo']['segmentMatrix']['01'] = 'Error while retrieving group in user!';
        $errorMatrix['functionMatrix']['getUserInfo']['segmentMatrix']['02'] = 'Error while retrieving kpi in user!';


        return $errorMatrix;
    }

    public static function GroupEntryController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '12';

        $errorMatrix['functionMatrix']['getAllGroupEntries']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getAllGroupEntries']['segmentMatrix']['00'] = 'No Entries found in collection!';

        $errorMatrix['functionMatrix']['getEntriesByFields']['functionId'] = '01';
        $errorMatrix['functionMatrix']['getEntriesByFields']['segmentMatrix']['00'] = 'No fields provided to query!';

        $errorMatrix['functionMatrix']['getEntries']['functionId'] = '02';
        $errorMatrix['functionMatrix']['getEntries']['segmentMatrix']['00'] = 'Insufficient parameters provided!';
        $errorMatrix['functionMatrix']['getEntries']['segmentMatrix']['01'] = 'No fields provided to query!';
        $errorMatrix['functionMatrix']['getEntries']['segmentMatrix']['02'] = 'Error while converting to date!';

        $errorMatrix['functionMatrix']['getWidgetByDashboardId']['functionId'] = '03';
        $errorMatrix['functionMatrix']['getWidgetByDashboardId']['segmentMatrix']['00'] = 'No DashboardId provided!';
        $errorMatrix['functionMatrix']['getWidgetByDashboardId']['segmentMatrix']['01'] = 'No Widgets found in dashboard!';

        $errorMatrix['functionMatrix']['updateWidget']['functionId'] = '04';
        $errorMatrix['functionMatrix']['updateWidget']['segmentMatrix']['00'] = 'No widgetId provided!';
        $errorMatrix['functionMatrix']['updateWidget']['segmentMatrix']['01'] = 'Provided nothing to update!';
        $errorMatrix['functionMatrix']['updateWidget']['segmentMatrix']['02'] = 'No such Widget found!';
        $errorMatrix['functionMatrix']['updateWidget']['segmentMatrix']['03'] = 'Error while updating widget in collection!';

        $errorMatrix['functionMatrix']['removeWidget']['functionId'] = '05';
        $errorMatrix['functionMatrix']['removeWidget']['segmentMatrix']['00'] = 'No WidgetId provided!';
        $errorMatrix['functionMatrix']['removeWidget']['segmentMatrix']['01'] = 'No such widget found!';
        $errorMatrix['functionMatrix']['removeWidget']['segmentMatrix']['02'] = 'Error while removing widget!';

        $errorMatrix['functionMatrix']['restoreWidget']['functionId'] = '06';
        $errorMatrix['functionMatrix']['restoreWidget']['segmentMatrix']['00'] = 'No WidgetId provided!';
        $errorMatrix['functionMatrix']['restoreWidget']['segmentMatrix']['01'] = 'No such Widget found!';
        $errorMatrix['functionMatrix']['restoreWidget']['segmentMatrix']['02'] = 'Error while restoring widget!';


        return $errorMatrix;
    }

    public static function SMSController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '13';

        $errorMatrix['functionMatrix']['store']['functionId'] = '00';
        $errorMatrix['functionMatrix']['store']['segmentMatrix']['00'] = 'Insufficient values provided!';
        $errorMatrix['functionMatrix']['store']['segmentMatrix']['01'] = 'No such domain found!';
        $errorMatrix['functionMatrix']['store']['segmentMatrix']['02'] = 'No user found with this number!';
        $errorMatrix['functionMatrix']['store']['segmentMatrix']['03'] = 'No sequence of kpis exists!';
        $errorMatrix['functionMatrix']['store']['segmentMatrix']['04'] = 'Either less or more values provided!';
        $errorMatrix['functionMatrix']['store']['segmentMatrix']['05'] = 'Error while saving user entries!';

        return $errorMatrix;
    }

    public static function TargetController()
    {
        $errorMatrix = array();
        $errorMatrix['classId'] = '14';

        $errorMatrix['functionMatrix']['getTarget']['functionId'] = '00';
        $errorMatrix['functionMatrix']['getTarget']['segmentMatrix']['00'] = 'No such target found!';

        $errorMatrix['functionMatrix']['createTarget']['functionId'] = '01';
        $errorMatrix['functionMatrix']['createTarget']['segmentMatrix']['00'] = 'Error while validating input(s)!';
        $errorMatrix['functionMatrix']['createTarget']['segmentMatrix']['01'] = 'Error while saving target!';
        $errorMatrix['functionMatrix']['createTarget']['segmentMatrix']['02'] = 'Error while saving target for user!';
        $errorMatrix['functionMatrix']['createTarget']['segmentMatrix']['03'] = 'Error while saving target for group!';

        $errorMatrix['functionMatrix']['updateTarget']['functionId'] = '02';
        $errorMatrix['functionMatrix']['updateTarget']['segmentMatrix']['00'] = 'No such target found!';
        $errorMatrix['functionMatrix']['updateTarget']['segmentMatrix']['01'] = 'No parameters provided to update target!';
        $errorMatrix['functionMatrix']['updateTarget']['segmentMatrix']['02'] = 'Error while updating target!';

        $errorMatrix['functionMatrix']['getKpis']['functionId'] = '03';
        $errorMatrix['functionMatrix']['getKpis']['segmentMatrix']['00'] = 'Error while retrieving kpis details in groups!';
        $errorMatrix['functionMatrix']['getKpis']['segmentMatrix']['01'] = 'No groups exists in user!';

        $errorMatrix['functionMatrix']['createNotification']['functionId'] = '04';
        $errorMatrix['functionMatrix']['createNotification']['segmentMatrix']['00'] = 'Error while creating notification for target!';

        $errorMatrix['functionMatrix']['removeTarget']['functionId'] = '05';
        $errorMatrix['functionMatrix']['removeTarget']['segmentMatrix']['00'] = 'No such target found!';
        $errorMatrix['functionMatrix']['removeTarget']['segmentMatrix']['01'] = 'Error while removing target!';

        $errorMatrix['functionMatrix']['removeTarget']['functionId'] = '06';
        $errorMatrix['functionMatrix']['removeTarget']['segmentMatrix']['00'] = 'No kpi provided!';

        $errorMatrix['functionMatrix']['getTargetSettings']['functionId'] = '07';
        $errorMatrix['functionMatrix']['getTargetSettings']['segmentMatrix']['00'] = 'No target Setting found!';

        $errorMatrix['functionMatrix']['getUserTargets']['functionId'] = '08';
        $errorMatrix['functionMatrix']['getUserTargets']['segmentMatrix']['00'] = 'No input provided!';

        $errorMatrix['functionMatrix']['getTargetForChart']['functionId'] = '09';
        $errorMatrix['functionMatrix']['getTargetForChart']['segmentMatrix']['00'] = 'No input provided!';

        return $errorMatrix;
    }

}
